  
 <div class="card">
  <div class="card-header"><h4>系统用户管理-修改</h4></div>
    <div class="card-body">
      <div class='row'>
         
        <div class="col-md-6">
              
                <form class="form-horizontal" onsubmit="return false;">
                  <div class="form-group">
                    <label class="col-xs-12" >manager_id</label>
                    <div class="col-xs-12">
                      <input class="form-control" type="text" id="manager_id"  value="{{ ctx.manager.manager_id }}" readonly="readonly">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-xs-12" >用户名</label>
                    <div class="col-xs-12">
                      <input class="form-control" type="text" id="username"  readonly="readonly" value="{{ ctx.manager.username }}">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-xs-12" for="pwd">密码</label>
                    <div class="col-xs-7">
                      <input class="form-control" type="password" id="pwd" name="pwd" readonly="readonly" value="{{ ctx.manager.pwd }}">
                    </div>
                    <div class="col-xs-4">
                       <button class="btn btn-primary" id='btn_pwdreset' >重置为:Admin_123</button>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-xs-12" for="xm">姓名</label>
                    <div class="col-xs-12">
                      <input class="form-control" type="text" id="xm" name="xm" value="{{ ctx.manager.xm }}">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-xs-12" for="tel">电话</label>
                    <div class="col-xs-12">
                      <input class="form-control" type="number" id="tel" name="tel"  value="{{ ctx.manager.tel }}">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-xs-12" for="example-select">角色分配</label>
                    <div class="col-xs-12">
                      <select class="form-control" id="role_id" name="example-select"  >
                        {% for option in ctx.role %}
                          {% if option.role_id == ctx.manager.role_id %}
                            <option value="{{ option.role_id }}">{{ option.rolemc }}</option>
                          {% endif %}
                        {% endfor %}
                        {% for option in ctx.role %}
                          {% if option.role_id != ctx.manager.role_id %}
                            <option value="{{ option.role_id }}">{{ option.rolemc }}</option>
                          {% endif %}
                        {% endfor %}
                      </select>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-xs-12" for="example-select">状态</label>
                    <div class="col-xs-12">
                    <select class="form-control" id="yxbz" name="example-select" key="{{ ctx.manager.yxbz }}"selected>
                      <option value="Y">有效</option>
                      <option value="N">无效</option>
                    </select>
                    </div>
                  </div>

                  <div class="form-group">
                    <div class="col-xs-12">
                      <div class="nav nav-drawer">
                        <button class="btn btn-primary" id='btn_save' >提交</button>
                        <a class="btn btn-warning" id='btn$xt_user' style="float:right;" >返回</a>
                      </div>
                    </div>
                  </div>
                </form>
                

          </div>

    </div>
  </div>
</div>

 <script src="static/js/bootstrap-table.min.js"></script>
 <script src="static/js/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript">
$(function(){



     $('#btn_save').click(function(){

        let data = {
          'manager_id':$('#manager_id').val(),
          'username' : $('#username').val(),
          'xm' : $('#xm').val(),
          'tel' : $('#tel').val(),
          'role_id' : $('#role_id').val(),
          'yxbz' : $('#yxbz').val()
        }

        $.ajax({
            "url":'/xt_user_edit',
            "async" : true,
            "dataType":'json',
            "data":data,
            "type" : "post",
            "success":function (data) {
                alert(data.mes)
                //清空表单
               
            },    
            "error":function (res) {  
                alert(res)
            } 
        });

     })

//重置密码
    $('#btn_pwdreset').click(function(){
          let manager_id = $('#manager_id').val()
          $.ajax({
            "url":'/xt_user_pwdreset',
            "async" : true,
            "dataType":'json',
            "data":{'manager_id':manager_id},
            "type" : "post",
            "success":function (data) {
                alert(data.mes)
                //清空表单
            },    
            "error":function (res) {  
                alert(res)
            } 
        });

    })



  })

</script>
